package gui;

import common.IGrid;

public class EarthGridThreadPush extends EarthGrid {
  private static final long serialVersionUID = -6269883305299264125L;
  private IGrid grid;
  
  public EarthGridThreadPush() {
    super();
  }
  
  public synchronized void updateGrid(IGrid grid) {
    this.grid = grid;
    notify();
  }
  
  public void run() {
    Thread thisThread = Thread.currentThread();
    
    while(true) {
      try {
        thisThread.sleep(10);

        synchronized (this) {
          wait();
        }
      }
      catch (InterruptedException e) {
        e.printStackTrace();
      }
      super.updateGrid(grid);
    }
  }
  
}
